package com.checkbox.widgetset.client.conn;

import com.checkbox.widgetset.Span;
import com.checkbox.widgetset.client.share.SpanState;
import com.checkbox.widgetset.client.ui.VSpan;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;

@SuppressWarnings("serial")
@Connect(Span.class)
public class SpanConnector extends AbstractComponentConnector {
  @Override
  public VSpan getWidget() {
    return (VSpan) super.getWidget();
  }

  @Override
  public SpanState getState() {
    return (SpanState) super.getState();
  }

  @Override
  public void onStateChanged(StateChangeEvent event) {
    super.onStateChanged(event);
    getWidget().setText(getState().text);
  }
}
